# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1Candidate do
  @moduledoc """
  A response candidate generated from the model.

  ## Attributes

  *   `avgLogprobs` (*type:* `float()`, *default:* `nil`) - Output only. Average log probability score of the candidate.
  *   `citationMetadata` (*type:* `GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1CitationMetadata.t`, *default:* `nil`) - Output only. Source attribution of the generated content.
  *   `content` (*type:* `GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1Content.t`, *default:* `nil`) - Output only. Content parts of the candidate.
  *   `finishMessage` (*type:* `String.t`, *default:* `nil`) - Output only. Describes the reason the mode stopped generating tokens in more detail. This is only filled when `finish_reason` is set.
  *   `finishReason` (*type:* `String.t`, *default:* `nil`) - Output only. The reason why the model stopped generating tokens. If empty, the model has not stopped generating the tokens.
  *   `groundingMetadata` (*type:* `GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1GroundingMetadata.t`, *default:* `nil`) - Output only. Metadata specifies sources used to ground generated content.
  *   `index` (*type:* `integer()`, *default:* `nil`) - Output only. Index of the candidate.
  *   `logprobsResult` (*type:* `GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1LogprobsResult.t`, *default:* `nil`) - Output only. Log-likelihood scores for the response tokens and top tokens
  *   `safetyRatings` (*type:* `list(GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1SafetyRating.t)`, *default:* `nil`) - Output only. List of ratings for the safety of a response candidate. There is at most one rating per category.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :avgLogprobs => float() | nil,
          :citationMetadata =>
            GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1CitationMetadata.t() | nil,
          :content => GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1Content.t() | nil,
          :finishMessage => String.t() | nil,
          :finishReason => String.t() | nil,
          :groundingMetadata =>
            GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1GroundingMetadata.t() | nil,
          :index => integer() | nil,
          :logprobsResult =>
            GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1LogprobsResult.t() | nil,
          :safetyRatings =>
            list(GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1SafetyRating.t()) | nil
        }

  field(:avgLogprobs)

  field(:citationMetadata,
    as: GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1CitationMetadata
  )

  field(:content, as: GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1Content)
  field(:finishMessage)
  field(:finishReason)

  field(:groundingMetadata,
    as: GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1GroundingMetadata
  )

  field(:index)
  field(:logprobsResult, as: GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1LogprobsResult)

  field(:safetyRatings,
    as: GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1SafetyRating,
    type: :list
  )
end

defimpl Poison.Decoder, for: GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1Candidate do
  def decode(value, options) do
    GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1Candidate.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1Candidate do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
